import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import BaseLayout from '@/layout/Base.vue'

Vue.use(VueRouter)

// const RouteView = {
//   name: 'RouteView',
//   render: (h: Function) => h('router-view'),
// }

const routes: Array<RouteConfig> = [
  {
    path: '/',
    name: 'BaseLayout',
    component: BaseLayout,
    redirect: '/',
    children: [
      {
        path: '/',
        name: 'Home',
        component: () => import(/* webpackChunkName: "Home" */ '@/views/Home.vue'),
        meta: { title: '首页' },
      },
      {
        path: '/DTsFile',
        name: 'DTsFile',
        component: () => import(/* webpackChunkName: "DTsFile" */ '@/views/DTsFile/index.vue'),
        meta: { title: 'd.ts文件的使用' },
      },
    ],
  },
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes,
})

export default router
